'\" te
.\" Copyright (c) 2006, Sun Microsystems, Inc.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SCSI_DMAGET 9F "Jan 16, 2006"
.SH NAME
scsi_dmaget, scsi_dmafree \- SCSI dma utility routines
.SH SYNOPSIS
.LP
.nf
#include <sys/scsi/scsi.h>



\fBstruct scsi_pkt *\fR\fBscsi_dmaget\fR(\fBstruct scsi_pkt *\fR\fIpkt\fR,
     \fBopaque_t\fR \fIdmatoken\fR, \fBint\fR\fB(*\fRcallback\fB)(void)\fR);
.fi

.LP
.nf
\fBvoid\fR \fBscsi_dmafree\fR(\fBstruct scsi_pkt *\fR\fIpkt\fR);
.fi

.SH INTERFACE LEVEL
.sp
.LP
These interfaces are obsolete. Use \fBscsi_init_pkt\fR(9F) instead of
\fBscsi_dmaget()\fR. Use \fBscsi_destroy_pkt\fR(9F) instead of
\fBscsi_dmafree()\fR.
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIpkt\fR\fR
.ad
.RS 12n
A pointer to a \fBscsi_pkt\fR(9S) structure.
.RE

.sp
.ne 2
.na
\fB\fIdmatoken\fR\fR
.ad
.RS 12n
Pointer to an implementation dependent object.
.RE

.sp
.ne 2
.na
\fB\fIcallback\fR\fR
.ad
.RS 12n
Pointer to a callback function, or \fBNULL_FUNC\fR or \fBSLEEP_FUNC.\fR
.RE

.SH DESCRIPTION
.sp
.LP
The \fBscsi_dmaget()\fR function allocates \fBDMA\fR resources for an already
allocated \fBSCSI\fR packet. \fIpkt\fR is a pointer to the previously allocated
\fBSCSI\fR packet (see \fBscsi_pktalloc\fR(9F)).
.sp
.LP
The \fIdmatoken\fR parameter is a pointer to an implementation dependent object
which defines the length, direction, and address of the data transfer
associated with this \fBSCSI \fRpacket (command). The \fIdmatoken\fR must be a
pointer to a \fBbuf\fR(9S) structure. If \fIdmatoken\fR is \fINULL\fR, no
resources are allocated.
.sp
.LP
The \fIcallback\fR parameter indicates what \fBscsi_dmaget()\fR should do when
resources are not available:
.sp
.ne 2
.na
\fB\fBNULL_FUNC\fR\fR
.ad
.RS 16n
Do not wait for resources. Return a \fINULL\fR pointer.
.RE

.sp
.ne 2
.na
\fB\fBSLEEP_FUNC\fR\fR
.ad
.RS 16n
Wait indefinitely for resources.
.RE

.sp
.ne 2
.na
\fBOther Values\fR
.ad
.RS 16n
\fIcallback\fR points to a function which is called when resources may have
become available. \fIcallback\fR must return either \fB0\fR (indicating that it
attempted to allocate resources but failed to do so again), in which case it is
put back on a list to be called again later, or \fB1\fR indicating either
success in allocating resources or indicating that it no longer cares for a
retry.
.RE

.sp
.LP
The \fBscsi_dmafree()\fR function frees the \fBDMA\fR resources associated with
the \fBSCSI\fR packet. The packet itself remains allocated.
.SH RETURN VALUES
.sp
.LP
The \fBscsi_dmaget()\fR function returns a pointer to a \fBscsi_pkt\fR on
success. It returns \fBNULL\fR if resources are not available.
.SH CONTEXT
.sp
.LP
If \fIcallback\fR is \fBSLEEP_FUNC\fR, then this routine may only be called
from user or kernel context. Otherwise, it may be called from user, kernel, or
interrupt context. The \fIcallback\fR function may not block or call routines
that block.
.sp
.LP
The \fBscsi_dmafree()\fR function can be called from user, interrupt, or kernel
context.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for a description of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Stability Level	Obsolete
.TE

.SH SEE ALSO
.sp
.LP
.BR attributes (7),
.BR scsi_pktalloc (9F),
.BR scsi_pktfree (9F),
.BR scsi_resalloc (9F),
.BR scsi_resfree (9F),
.BR buf (9S),
.BR scsi_pkt (9S)
.sp
.LP
\fIWriting Device Drivers\fR
.SH NOTES
.sp
.LP
The \fBscsi_dmaget()\fR and \fBscsi_dmafree()\fR functions are obsolete and
will be discontinued in a future release. These functions have been replaced
by, respectively, \fBscsi_init_pkt\fR(9F) and \fBscsi_destroy_pkt\fR(9F).
